package ac.zlf.maven.plugin.spring_mybatis_template;

import ac.zlf.maven.plugin.spring_mybatis_template.repaid.Gen;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Mojo(name = "spring_boot_fx_to_view", requiresProject = true, threadSafe = true, defaultPhase = LifecyclePhase.GENERATE_SOURCES)
public class RepaidGenSpringBootFxToViewMojo extends AbstractMojo {

    private Logger logger = LoggerFactory.getLogger(RepaidGenSpringBootFxToViewMojo.class);

    @Parameter(defaultValue = "file://${project.basedir}/src/main/resources/generator.properties", required = true)
    private String configurationFile;

    @Override
    public void execute() throws MojoExecutionException, MojoFailureException {
        Gen.generator(this.configurationFile, Gen.templates.get("spring_boot_fx_to_view"));
    }
}